package reactor;

import org.junit.Test;
import reactor.core.publisher.Mono;
import util.Util;

public class ContextTest {

    @Test
    public void testContext() {
        String key = "message";
        Mono<String> r = Mono.just("Hello")
                .flatMap(s ->
                        Mono.subscriberContext().map(ctx -> s + " " + ctx.get(key)))
                .subscriberContext(ctx -> ctx.put(key, "World"));
        r.subscribe(Util::print);
    }


}